package com.idanchuang.user.count.service.api.client;

import com.idanchuang.component.base.JsonResult;
import com.idanchuang.user.count.service.api.request.command.read.AddSysMsgCommand;
import com.idanchuang.user.count.service.api.request.command.read.AddUserMsgCommand;
import com.idanchuang.user.count.service.api.request.command.read.BatchAddUserMsgCommand;
import com.idanchuang.user.count.service.api.request.command.read.RemoveSysMsgCommand;
import com.idanchuang.user.count.service.api.request.command.read.RemoveUserMsgCommand;
import com.idanchuang.user.count.service.api.request.command.read.UserMsgAllReadCommand;
import com.idanchuang.user.count.service.api.request.query.read.BatchUserUnreadMsgCountQuery;
import com.idanchuang.user.count.service.api.request.query.read.UserMsgIfReadBatchQuery;
import com.idanchuang.user.count.service.api.request.query.read.UserUnreadMsgCountQuery;
import com.idanchuang.user.count.service.api.response.BatchUserSceneCountDTO;
import com.idanchuang.user.count.service.api.response.UserSceneCountDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.util.List;

/**
 * @author Richard_yyf
 * @version 1.0 2021/6/22
 */
@FeignClient(value = "count-service", contextId = "count-service.user.msg.count")
public interface MsgUnreadCountClient {

    String PREFIX = "/user/msg-count-api";


    /**
     * 将某一场景消息设置为全部已读
     * @param readCommand 请求内容
     * @return 请求处理结果
     */
    @PostMapping(PREFIX + "/readAll")
    JsonResult<Void> readAll(@RequestBody @Valid UserMsgAllReadCommand readCommand);

    /**
     * 添加用户未读消息
     * @param addUserMsgCommand 请求内容
     * @return 请求处理结果
     */
    @PostMapping(PREFIX + "/addUserMsg")
    JsonResult<Void> addUserMsg(@RequestBody @Valid AddUserMsgCommand addUserMsgCommand);

    /**
     * 一条消息 多用户 批量添加
     * @param batchAddUserMsgCommand batch command
     * @return 请求处理结果
     */
    @PostMapping(PREFIX + "/batchAddUserMsg")
    JsonResult<Void> batchAddUserMsg(@RequestBody @Valid BatchAddUserMsgCommand batchAddUserMsgCommand);

    /**
     * 添加系统未读消息
     * @param addSysMsgCommand 请求内容
     * @return 请求处理结果
     */
    @PostMapping(PREFIX + "/addSysMsg")
    JsonResult<Void> addSysMsg(@RequestBody @Valid AddSysMsgCommand addSysMsgCommand);

    /**
     * 删除系统未读消息
     * @param removeSysMsgCommand 请求内容
     * @return 请求处理结果
     */
    @PostMapping(PREFIX + "/removeSysMsg")
    JsonResult<Void> removeSysMsg(@RequestBody @Valid RemoveSysMsgCommand removeSysMsgCommand);

    /**
     * 删除用户维度的未读消息
     * @param removeUserMsgCommand 请求内容
     * @return 请求处理结果
     */
    @PostMapping(PREFIX + "/removeUserMsg")
    JsonResult<Void> removeUserMsg(@RequestBody @Valid RemoveUserMsgCommand removeUserMsgCommand);

    /**
     * 统计用户该场景下未读数
     * @param unreadMsgCountQuery 请求内容
     * @return 未读数统计
     */
    @PostMapping(PREFIX + "/queryUnreadMsgCount")
    JsonResult<UserSceneCountDTO> queryUnreadMsgCount(@RequestBody @Valid UserUnreadMsgCountQuery unreadMsgCountQuery);

    /**
     * 批量场景 统计用户该场景下未读数
     * @param batchUserUnreadMsgCountQuery 请求内容
     * @return 批量场景 未读数统计
     */
    @PostMapping(PREFIX + "/batchQueryUnreadMsgCount")
    JsonResult<BatchUserSceneCountDTO> batchQueryUnreadMsgCount(@RequestBody @Valid BatchUserUnreadMsgCountQuery batchUserUnreadMsgCountQuery);

    /**
     * 批量查询指定消息集合对用户是否已读
     * @param userMsgIfReadBatchQuery 请求内容
     * @return 未读消息 list
     */
    @PostMapping(PREFIX + "batchQueryUserMsgIfRead")
    JsonResult<List<String>> batchQueryUserMsgIfRead(@RequestBody @Valid UserMsgIfReadBatchQuery userMsgIfReadBatchQuery);
}
